﻿<%@ Page Title="" Language="C#" MasterPageFile="~/master_form.master" AutoEventWireup="true" CodeFile="cai_ma_sv.aspx.cs" Inherits="App_Form_tuyen_sinh_cai_ma_sv" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
     <script type="text/javascript">
         Ext.Loader.setConfig({
             enabled: true
         });
         Ext.Loader.setPath('Ext.ux', '../ux');

         Ext.require([
         'Ext.selection.CellModel',
         'Ext.grid.*',
         'Ext.data.*',
         'Ext.util.*',
         'Ext.state.*',
         'Ext.form.*',
         'Ext.grid.Panel'
         ]);

         Ext.onReady(function () {

             Ext.QuickTips.init();

             var bd = Ext.getBody();
             myMask = new Ext.LoadMask(bd, { msg: "Đang xử lý..." });

             var gridForm = Ext.create('Ext.form.Panel', {
                 id: 'company-form',
                 frame: true,
                 bodyPadding: 5,
                 layout: {
                     type: 'column',
                     columns: 2
                 },
                 fieldDefaults: {
                     labelAlign: 'left',
                     msgTarget: 'side'
                 },

                 items: [
                     {
                         margin: '0 0 0 2',
                         padding: '10 5 5 5',
                         xtype: 'fieldset',
                         title: '',
                         defaults: {
                             width: 350,
                             labelWidth: 90
                         },
                         defaultType: 'textfield',
                         items: [
                             {
                                 fieldLabel: 'Năm áp dụng',
                                 xtype: 'combo', value: 'I', emptyText: 'Chọn năm học',
                                 triggerAction: 'all', forceSelection: true, editable: false,
                                 id: 'nam_hoc', name: 'nam_hoc', displayField: 'ten', valueField: 'id',
                                 queryMode: 'local',
                                 listeners: {
                                     select: function (combo, record, index) {
                                         if (record.length > 0) {
                                             var b_nam = record[0].get('id');
                                             wsinh_vien.Fs_MA_SV_LKE(b_nam, ma_sv_P_KQ, P_LOI_CSDL, P_LOI_TGIAN);
                                         }
                                     }
                                 }
                             },
                             {
                                 fieldLabel: 'Tiền tố', id: 'ma_sv', name: 'ma_sv'
                             },
                         {
                             xtype: 'fieldcontainer',
                             combineErrors: true,
                             layout: {
                                 type: 'hbox',
                                 defaultMargins: { top: 0, right: 5, bottom: 0, left: 0 }
                             },
                             items: [

                                 {
                                     name: 'In',
                                     xtype: 'button',
                                     margin: '0 0 0 5',
                                     width: 120,
                                     icon: '../../shared/icons/fam/add.png',
                                     text: 'Xác nhân',
                                     handler: function () {
                                         myMask.show();
                                         var b_nam = Ext.getCmp("nam_hoc").getValue(), b_ma_sv = Ext.getCmp("ma_sv").getValue();
                                         wsinh_vien.Fs_MA_SV_NH(b_nam, b_ma_sv, ma_sv_nh_P_KQ, P_LOI_CSDL, P_LOI_TGIAN);
                                         
                                     }
                                 }
                             ]
                         }
                         ]
                     }
                 ],
                 renderTo: bd
             });
             wsinh_vien.Fs_DIEM_TUYEN_SINH_TTCHUNG(P_LOAD_TTCHUNG, P_LOI_CSDL, P_LOI_TGIAN);
         });

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <script type="text/javascript">
        function P_LOAD_TTCHUNG(b_kq) {
            if (Fb_LOI_KTRA(b_kq)) {
                form_P_LOI(b_kq);
                return;
            }

            var a_kq = b_kq.split('@');
            var b_chuoi1 = CH_JSON(a_kq[0]);

            var a_data1 = Ext.create('Ext.data.Store', {
                fields: ['id', 'ten'],
                data: b_chuoi1
            });


            var cd = Ext.getCmp('nam_hoc');
            cd.bindStore(a_data1);
        }
        function ds_bao_diem_P_KQ(b_kq) {
            if (Fb_LOI_KTRA(b_kq)) {
                form_P_LOI(b_kq);
                return;
            }

            var tenf = '<%= this.ResolveUrl("~/Outputs/")%>';
            var a_kq = b_kq.split('/');
            tenf = tenf + a_kq[2];
            window.location.assign(tenf);
        }
        function ma_sv_P_KQ(b_kq)
        {
            if (Fb_LOI_KTRA(b_kq)) {
                form_P_LOI(b_kq);
                return;
            }
            Ext.getCmp("ma_sv").setValue(b_kq);
        }
        function ma_sv_nh_P_KQ(b_kq)
        {
            myMask.hide();
            if (Fb_LOI_KTRA(b_kq)) {
                form_P_LOI(b_kq);
                return;
            }
            alert("Cài đặt thành công");
        }
    </script>
</asp:Content>

